clear*
set maxvar 11000

global date _2025_10_28
cd "/Users/atri0032/Dropbox/World Bank/Temperature, poverty, and inequality/Estimations/"

******************************************************************************************
********************************** Table S7: Alternative measure of poverty – Multidimensional poverty
******************************************************************************************

use "${date}/_data/spid_for_analysis_v2.dta", clear

sort geo_code2_new year
	merge m:1 geo_code2_new year using "${date}/_data/Multidimensional_poverty.dta"
	drop if _merge==2
	drop _merge

sum dep_poor1 dep_educ_com dep_educ_enr dep_infra_elec dep_infra_imps dep_infra_impw2 
 
local outcome dep_poor1 dep_educ_com dep_educ_enr dep_infra_elec dep_infra_imps dep_infra_impw2
local controls ln_GDPppp Unempilo agri manuf popgr 

foreach v of local outcome {
	qui reghdfe `v' temp rainfall_sum humid `controls', absorb(geo_code2_new year) cluster(geo_code2_new) keepsingle
    est store m`v'   		
	qui su `v' if e(sample), meanonly
	estadd sca depmean = r(mean) 	 
} 
 
local opts ///
         keep(temp) ///
         cells(b(star fmt(3)) se(par fmt(3))) star(* 0.10 ** 0.05 *** 0.01) ///
         stats(N depmean, fmt(0 3) ///
         label("Observations" "Mean dep. var")) ///  
         eqlabels(none)  ///
         collabels(,none) varlabels(temp "Temperature") varwidth(25)     

esttab m*, `opts' 
esttab m* using "${date}/_tables/_tab_s7.csv", replace `opts' 
